#include "../../../common/asr.hpp"
#include <gflags/gflags.h>

DEFINE_string(app_id,"115757887","语音平台的应用ID");
DEFINE_string(api_key,"JkV5j87okj6GiYbJBRCvx1uk","语音平台的API密钥");
DEFINE_string(secret_key,"KvIdpvgNSXPo7KXvbtHvv3mC49rvRf2Z","语音平台的加密密钥");

DEFINE_bool(run_mode,false,"程序的运行模式，false： 调试 true： 发布");
DEFINE_string(log_file,"","发布模式下，向文件中输出，如果是调试模式下，模式是stdout");
DEFINE_int32(log_level,0,"发布模式下，用于指定的日志输出等级");

int main(int argc,char* argv[])
{
    google::ParseCommandLineFlags(&argc,&argv,true);
    init_logger(FLAGS_run_mode,FLAGS_log_file,FLAGS_log_level);

    ASRClient client(FLAGS_app_id,FLAGS_api_key,FLAGS_secret_key);    

    std::string file_content;
    std::string err_msg;
    aip::get_file_content("./public/16k.pcm",&file_content);
    std::string ret = client.recognize(file_content,err_msg);
    if(ret.empty()) {
        return -1;
    }
    std::cout << ret << std::endl;

    return 0;
}